<?php

//$link=  base_url()."assets/fpdf17/fpdf.php";
include('assets/fpdf17/fpdf.php');
$lib_rupiah = new Format_rupiah();
$totalsemua = 0;

class PDF extends FPDF {

    // Page header
    function Header() {
        // Logo
//        $this->SetFont('Arial', '', 12);
//        $this->Line(10, 22, 200, 22);
//        $this->Ln(17);
    }

}

$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();

$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(0, 0, 'LAPORAN DAFTAR STOK PRODUK ', 0, 0, 'C');

$pdf->Ln(4);
$pdf->SetFont('Times', '', 8);
$pdf->Cell(0, 0, 'Tanggal : '.  date("d M yy"), 0, 0, 'C');

//else if ($id == 2)
//    $pdf->Cell(0, 0, 'STATUS GAGAL', 0, 0, 'C');
//else if ($id == 3)
//    $pdf->Cell(0, 0, 'STATUS SUKSES', 0, 0, 'C');
//$pdf->Ln(4);


$pdf->SetFont('Times', '', 10);


$pdf->Ln(5);


$n = 0;
$pdf->SetFont('Times', '', 7);
$pdf->SetFillColor(234, 234, 234);
$pdf->Cell(13, 5, ' KODE  ', 'LRTB', 0, 'C', 1);
$pdf->Cell(80, 5, ' NAMA PRODUK ', 'LRTB', 0, 'C', 1);
$pdf->Cell(30, 5, ' WARNA ', 'LRTB', 0, 'C', 1);
$pdf->Cell(10, 5, ' STOK ', 'LRTB', 0, 'C', 1);
$pdf->Cell(30, 5, ' HARGA ', 'LRTB', 0, 'C', 1);
$pdf->Cell(12, 5, ' DISC ', 'LRTB', 0, 'C', 1);
$pdf->Cell(15, 5, ' BERAT (kg) ', 'LRTB', 0, 'C', 1);
$pdf->Ln();
foreach ($produk as $pro) {

    $pdf->SetFillColor(255, 255, 255);
    $pdf->Cell(13, 5, $pro->id_produk.".".$pro->id, 'LRTB', 0, 'C', 1);
    $pdf->Cell(80, 5, $pro->nama_produk." - ".$pro->size_produk, 'LRTB', 0, '', 1);
    $pdf->Cell(30, 5, $pro->warna, 'LRTB', 0, 'C', 1);
    $pdf->Cell(10, 5, $pro->stok, 'LRTB', 0, 'C', 1);
    $pdf->Cell(30, 5, $lib_rupiah->rupiah($pro->harga), 'LRTB', 0, 'R', 1);
    $pdf->Cell(12, 5, $pro->disk . " % ", 'LRTB', 0, 'C', 1);
    $pdf->Cell(15, 5, $pro->berat . " % ", 'LRTB', 0, 'C', 1);
        $pdf->Ln();
}


$pdf->Output();
?>